/*
 * Invoice.java 2012-8-21
 * Copyright(c) 20012-2015 by covidien
 * ALL Rights Reserved.
 */
package com.mvc.finance.model;

import java.util.Date;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.Length;

import com.mvc.ProjectUtils;
import com.mvc.base.model.BaseCompany;
import com.mvc.base.model.Customer;

/**
 * 
 * @author Bob pu [bangxiong.pu@covidien.com]
 * @version V1.0 Create Time: 2012-8-21
 */
@Entity(name = "B_COMMERCIAL_INVOICE")
public class CommercialInvoice extends BaseCompany {

	@NotNull
	private Integer	                      customerId;
	@NotNull
	private Integer	                      type;
	@Length(max = 32)
	private String	                      byOthers;

	@NotNull
	private Date	                      invoiceDate;
	@Length(max = 32)
	private String	                      blNo;
	@NotNull
	private Integer	                      currency;
	@Transient
	private List<CommercialInvoiceItem>	  commercialInvoiceItems;
	@Transient
	private List<CommercialInvoiceCharge>	commercialInvoiceCharges;

	@NotNull
	@Length(max = 32)
	private String	                      originCountry;
	@NotNull
	@Length(max = 64)
	private String	                      shipment;

	@NotNull
	@Length(max = 64)
	private String	                      shipName;
	@NotNull
	private Date	                      shipDate;
	@NotNull
	private Date	                      eta;
	// 预计付款日期
	@NotNull
	private Date	                      predictPayDate;

	private Date	                      payDate;
	@NotNull
	@Length(max = 64)
	private String	                      payment;

	@NotNull
	private Double	                      total;
	@NotNull
	private Integer	                      status;
	// 开单人
	@NotNull
	private Integer	                      userId;

	private Integer	                      approvalUserId;

	private Date	                      approvalDate;

	@Length(max = 64)
	private String	                      backwardReason;

	@Transient
	private Customer	                  customer;
	@Transient
	private String	                      orderIds;

	/**
	 * @return the type
	 */
	public Integer getType() {
		return type;
	}

	/**
	 * @param type
	 *            the type to set
	 */
	public void setType(Integer type) {
		this.type = type;
	}

	/**
	 * @return the invoiceDate
	 */
	public Date getInvoiceDate() {
		return invoiceDate;
	}

	/**
	 * @param invoiceDate
	 *            the invoiceDate to set
	 */
	public void setInvoiceDate(Date invoiceDate) {
		this.invoiceDate = invoiceDate;
	}

	/**
	 * @return the blNo
	 */
	public String getBlNo() {
		return blNo;
	}

	/**
	 * @param blNo
	 *            the blNo to set
	 */
	public void setBlNo(String blNo) {
		this.blNo = blNo;
	}

	/**
	 * @return the commercialInvoiceItems
	 */
	public List<CommercialInvoiceItem> getCommercialInvoiceItems() {
		return commercialInvoiceItems;
	}

	/**
	 * @param commercialInvoiceItems
	 *            the commercialInvoiceItems to set
	 */
	public void setCommercialInvoiceItems(List<CommercialInvoiceItem> commercialInvoiceItems) {
		this.commercialInvoiceItems = commercialInvoiceItems;
	}

	public Integer getCurrency() {
		return currency;
	}

	public void setCurrency(Integer currency) {
		this.currency = currency;
	}

	public String getNo() {
		return ProjectUtils.getCommercialInvoiceNo(getObjectId());
	}

	public String getByOthers() {
		return byOthers;
	}

	public void setByOthers(String byOthers) {
		this.byOthers = byOthers;
	}

	public String getOriginCountry() {
		return originCountry;
	}

	public void setOriginCountry(String originCountry) {
		this.originCountry = originCountry;
	}

	public String getShipment() {
		return shipment;
	}

	public void setShipment(String shipment) {
		this.shipment = shipment;
	}

	public String getShipName() {
		return shipName;
	}

	public void setShipName(String shipName) {
		this.shipName = shipName;
	}

	public Date getShipDate() {
		return shipDate;
	}

	public void setShipDate(Date shipDate) {
		this.shipDate = shipDate;
	}

	public Date getEta() {
		return eta;
	}

	public void setEta(Date eta) {
		this.eta = eta;
	}

	public List<CommercialInvoiceCharge> getCommercialInvoiceCharges() {
		return commercialInvoiceCharges;
	}

	public void setCommercialInvoiceCharges(List<CommercialInvoiceCharge> commercialInvoiceCharges) {
		this.commercialInvoiceCharges = commercialInvoiceCharges;
	}

	public Integer getCustomerId() {
		return customerId;
	}

	public void setCustomerId(Integer customerId) {
		this.customerId = customerId;
	}

	public String getCustomerNo() {
		return ProjectUtils.getCustomerNo(customerId);
	}

	public Customer getCustomer() {
		return customer;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	public String getOrderIds() {
		return orderIds;
	}

	public void setOrderIds(String orderIds) {
		this.orderIds = orderIds;
	}

	public Double getTotal() {
		return total;
	}

	public void setTotal(Double total) {
		this.total = total;
	}

	public Date getPredictPayDate() {
		return predictPayDate;
	}

	public void setPredictPayDate(Date predictPayDate) {
		this.predictPayDate = predictPayDate;
	}

	public Date getPayDate() {
		return payDate;
	}

	public void setPayDate(Date payDate) {
		this.payDate = payDate;
	}

	public String getPayment() {
		return payment;
	}

	public void setPayment(String payment) {
		this.payment = payment;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public Integer getApprovalUserId() {
		return approvalUserId;
	}

	public void setApprovalUserId(Integer approvalUserId) {
		this.approvalUserId = approvalUserId;
	}

	public Integer getUserId() {
		return userId;
	}

	public void setUserId(Integer userId) {
		this.userId = userId;
	}

	public String getBackwardReason() {
		return backwardReason;
	}

	public void setBackwardReason(String backwardReason) {
		this.backwardReason = backwardReason;
	}

	public Date getApprovalDate() {
		return approvalDate;
	}

	public void setApprovalDate(Date approvalDate) {
		this.approvalDate = approvalDate;
	}
}
